﻿<%@ Page Title="Aproveitamento de Disciplinas" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="AproveitamentoDisciplinas.aspx.cs" Inherits="AcadPosApp.ControlarMatricula.AproveitamentoDisciplinas" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function setaFoco(elemento) {
            var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

            if (keyCode == 13) {
                var i;
                for (i = 0; i < elemento.form.elements.length; i++)
                    if (elemento == elemento.form.elements[i])
                        break;
                i = (i + 1) % elemento.form.elements.length;
                elemento.form.elements[i].focus();
                event.preventDefault();
                return false;
            }
            return false;
        }
        function formatar_mascara(src, mascara) {
            var campo = src.value.length;
            var saida = mascara.substring(0, 1);
            var texto = mascara.substring(campo);
            if (texto.substring(0, 1) != saida) {
                src.value += texto.substring(0, 1);
            }
        }


        function saltar() {
            if (event.keyCode == 13) {
                event.keyCode = 9;
            }
        } 
    </script>
    <style type="text/css">
        .style1
        {
            width: 313px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlPesquisa" runat="server" GroupingText="Consulta de Alunos">
                <table class="form-inline">
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="Label1" runat="server" Text="Estado"></asp:Label>
                            <br />
                            <asp:DropDownList ID="ddlEstadoPesquisa" runat="server" OnSelectedIndexChanged="ddlEstadoPesquisa_SelectedIndexChanged"
                                AutoPostBack="True" Width="150px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            <asp:Label ID="Label2" runat="server" Text="Descrição"></asp:Label>
                            <br />
                            <asp:TextBox ID="TxtPesquisa" required pattern="[çÇùÙúÚôÔõÕòÒóÓìÌíÍêÊèÈéÉáÁàÀãÃâÂaA-zZ\s]+$"
                                title="Apenas Letras." runat="server" Width="300px" MaxLength="150"></asp:TextBox>
                        </td>
                        <td>
                            <br />
                            <asp:Button ID="btnConsultar" runat="server" Text="Consultar" OnClick="btnConsultar_Click" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:GridView ID="gvwPesquisa" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    CssClass="mGrid" DataKeyNames="MATRICULA,CPF" EmptyDataText="Dados não localizados..."
                    GridLines="Vertical" Width="70%" OnSelectedIndexChanged="gvwPesquisa_SelectedIndexChanged"
                    OnPageIndexChanging="gvwPesquisa_PageIndexChanging">
                    <AlternatingRowStyle BackColor="#D3D3D3" />
                    <Columns>
                        <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True" />
                        <asp:BoundField DataField="MATRICULA" HeaderText="Matrícula">
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NOME" HeaderText="Nome">
                            <ItemStyle HorizontalAlign="Left" Width="90%" />
                        </asp:BoundField>
                    </Columns>
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#808080" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#383838" />
                </asp:GridView>                
            </asp:Panel>
            <br />
            <asp:Panel ID="pnlMatriculasAluno" runat="server" GroupingText="Matrículas do Aluno"
                Visible="false">
                <asp:GridView ID="gvwMatriculasAluno" runat="server" AutoGenerateColumns="False"
                    CssClass="mGrid" DataKeyNames="ID_MATRICULA, MATRICULA,ID_TURMA" EmptyDataText="Dados não localizados..."
                    GridLines="Vertical" Width="70%" AllowPaging="True" OnPageIndexChanging="gvwMatriculasAluno_PageIndexChanging"
                    OnSelectedIndexChanged="gvwMatriculasAluno_SelectedIndexChanged">
                    <AlternatingRowStyle BackColor="#D3D3D3" />
                    <Columns>
                        <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True" />
                        <asp:BoundField DataField="ID_CURSO" HeaderText="Código">
                            <HeaderStyle HorizontalAlign="Center" Width="1%" />
                            <ItemStyle HorizontalAlign="Center" Width="1%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NOME_CURSO" HeaderText="Curso">
                            <HeaderStyle HorizontalAlign="Center" Width="30%" />
                            <ItemStyle HorizontalAlign="Left" Width="30%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CURRICULO" HeaderText="Currículo">
                            <HeaderStyle HorizontalAlign="Center" Width="10%" />
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NOME_MODULO" HeaderText="Módulo">
                            <HeaderStyle HorizontalAlign="Center" Width="30%" />
                            <ItemStyle HorizontalAlign="Left" Width="30%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="COD_TURMA" HeaderText="Turma">
                            <HeaderStyle HorizontalAlign="Center" Width="10%" />
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ESTADO" HeaderText="Estado">
                            <HeaderStyle HorizontalAlign="Center" Width="1%" />
                            <ItemStyle HorizontalAlign="Left" Width="1%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NOME_POLO" HeaderText="Polo">
                            <HeaderStyle HorizontalAlign="Center" Width="10%" />
                            <ItemStyle HorizontalAlign="Left" Width="10%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DATA_MATRICULA" HeaderText="Dt.Matrícula">
                            <HeaderStyle HorizontalAlign="Center" Width="30%" />
                            <ItemStyle HorizontalAlign="Left" Width="30%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="SITUACAO" HeaderText="Situação">
                            <HeaderStyle HorizontalAlign="Center" Width="10%" />
                            <ItemStyle HorizontalAlign="Left" Width="10%" />
                        </asp:BoundField>
                    </Columns>
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#808080" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#383838" />
                </asp:GridView>
            </asp:Panel>
            <br />
            <asp:Panel ID="pnlDisciplinasMatricula" runat="server" GroupingText="Disciplinas Cursadas/Cursando"
                Visible="False">
                <asp:GridView ID="gvwDiscMatricula" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
                    DataKeyNames="ID_DISCIPLINA,ID_PROFISSIONAL_DISCIPLINA,ID_PROFISSIONAL,ID_TURMA,ID_MATRIZ_CURRICULAR,ID_MATRICULA_DISCIPLINA"
                    EmptyDataText="Dados não localizados..." GridLines="Vertical" Width="95%"
                    OnRowCancelingEdit="gvwDiscMatricula_RowCancelingEdit" OnRowEditing="gvwDiscMatricula_RowEditing"
                    OnRowUpdating="gvwDiscMatricula_RowUpdating">
                    <AlternatingRowStyle BackColor="#D3D3D3" />
                    <Columns>
                        <asp:BoundField DataField="NOME_DISCIPLINA" HeaderText="Disciplina" ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="40%" />
                            <ItemStyle HorizontalAlign="Left" Width="40%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CH_DISCIPLINA" HeaderText="C.H." ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="5%" />
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:BoundField>
                        <%--<asp:BoundField DataField="FALTA1" HeaderText="Faltas">
                    <HeaderStyle HorizontalAlign="Center" Width="20%" />
                    <ItemStyle HorizontalAlign="Center" Width="20%" />
                </asp:BoundField>--%>
                        <asp:TemplateField HeaderText="Falta">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtFalta1" HorizontalAlign="Center" MaxLength="2" runat="server"
                                    onkeypress="setaFoco(this)" onFocus="this.select()" Text='<%# Bind("FALTA1") %>'
                                    Width="80px"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtFalta1"
                                    ErrorMessage="Campo Falta aceita apenas números." ValidationExpression="([0-9]+)"
                                    ValidationGroup="gravar">*</asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("FALTA1") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="80px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <%--<asp:BoundField DataField="NOTA1" HeaderText="Nota" >
                    <HeaderStyle HorizontalAlign="Center" Width="14%" />
                    <ItemStyle HorizontalAlign="Center" Width="14%" />
                </asp:BoundField>--%>
                        <asp:TemplateField HeaderText="Nota">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNota1" HorizontalAlign="Center" MaxLength="5" runat="server"
                                    onkeypress="setaFoco(this)" onFocus="this.select()" Text='<%# Bind("NOTA1") %>'
                                    Width="80px"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtNota1"
                                    ErrorMessage="Campo Nota aceita apenas números e vírgula." ValidationExpression="([\,0-9]+)"
                                    ValidationGroup="gravar">*</asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("NOTA1") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="80px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="SITUACAO" HeaderText="Situação" ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="14%" />
                            <ItemStyle HorizontalAlign="Center" Width="14%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="COD_TURMA" HeaderText="Turma" ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="14%" />
                            <ItemStyle HorizontalAlign="Center" Width="14%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DESCRICAO_TITULACAO" HeaderText="Titulação" ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="10%" />
                            <ItemStyle HorizontalAlign="Left" Width="10%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="PROFISSIONAL" HeaderText="Docente" ReadOnly="True">
                            <HeaderStyle HorizontalAlign="Center" Width="20%" />
                            <ItemStyle HorizontalAlign="Left" Width="20%" />
                        </asp:BoundField>
                        <asp:CommandField ButtonType="Button" CancelText="Cancelar" EditText="Alterar" ShowEditButton="True"
                            UpdateText="Salvar" ValidationGroup="gravar" ControlStyle-Width="200px">
                            <ControlStyle CssClass="btn btn-success" Width="100px" />
                            <HeaderStyle />
                            <ItemStyle HorizontalAlign="Center"  />
                        </asp:CommandField>
                    </Columns>
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
                    <%--<SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />--%>
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#808080" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#383838" />
                </asp:GridView>
                <br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnCancelar" formnovalidate="formnovalidate" runat="server" Text="Cancelar"
                    OnClick="btnCancelar_Click" /><br /><br />
                <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True"
                    ShowSummary="False" ValidationGroup="gravar" />
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="gvwDiscMatricula" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
